package com.tencent.tws.watchfacelib;

import android.content.ComponentName;
import android.content.Context;
import android.content.ServiceConnection;
import android.os.IBinder;
import android.util.Log;

public abstract class ServiceConnectionManager
  implements ServiceConnection
{
  private static final String TAG = ServiceConnectionManager.class.getSimpleName();
  private boolean bound = false;
  private final Context context;
  private boolean isBinding = false;
  
  public ServiceConnectionManager(Context paramContext)
  {
    this.context = paramContext;
  }
  
  /* Error */
  public boolean bindService(android.content.Intent paramIntent, int paramInt)
  {
    try {
      isBinding = true;
      Log.i("zyltest","Service binding...");
      bound = context.bindService(paramIntent,this,paramInt);
      Log.i("zyltest","Service binding..."+bound);
    }catch (Exception e){
      e.printStackTrace();
    }finally {
      isBinding = false;
    }

    // Byte code:
    //   0: iconst_0
    //   1: istore 4
    //   3: aload_0
    //   4: monitorenter
    //   5: aload_0
    //   6: getfield 34	com/tencent/tws/watchfacelib/ServiceConnectionManager:context	Landroid/content/Context;
    //   9: ifnonnull +19 -> 28
    //   12: getstatic 23	com/tencent/tws/watchfacelib/ServiceConnectionManager:TAG	Ljava/lang/String;
    //   15: ldc 38
    //   17: invokestatic 44	android/util/Log:e	(Ljava/lang/String;Ljava/lang/String;)I
    //   20: pop
    //   21: iload 4
    //   23: istore_3
    //   24: aload_0
    //   25: monitorexit
    //   26: iload_3
    //   27: ireturn
    //   28: iload 4
    //   30: istore_3
    //   31: aload_0
    //   32: getfield 30	com/tencent/tws/watchfacelib/ServiceConnectionManager:isBinding	Z
    //   35: ifne -11 -> 24
    //   38: iload 4
    //   40: istore_3
    //   41: aload_0
    //   42: getfield 32	com/tencent/tws/watchfacelib/ServiceConnectionManager:bound	Z
    //   45: ifne -21 -> 24
    //   48: aload_0
    //   49: iconst_1
    //   50: putfield 30	com/tencent/tws/watchfacelib/ServiceConnectionManager:isBinding	Z
    //   53: aload_0
    //   54: getfield 34	com/tencent/tws/watchfacelib/ServiceConnectionManager:context	Landroid/content/Context;
    //   57: aload_1
    //   58: aload_0
    //   59: iload_2
    //   60: invokevirtual 49	android/content/Context:bindService	(Landroid/content/Intent;Landroid/content/ServiceConnection;I)Z
    //   63: istore_3
    //   64: goto -40 -> 24
    //   67: astore_1
    //   68: aload_0
    //   69: monitorexit
    //   70: aload_1
    //   71: athrow
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	72	0	this	ServiceConnectionManager
    //   0	72	1	paramIntent	android.content.Intent
    //   0	72	2	paramInt	int
    //   23	41	3	bool1	boolean
    //   1	38	4	bool2	boolean
    // Exception table:
    //   from	to	target	type
    //   5	21	67	finally
    //   31	38	67	finally
    //   41	64	67	finally
    return bound;
  }
  
  public boolean isBound()
  {
    return this.bound;
  }
  
  public void onServiceConnected(ComponentName paramComponentName, IBinder paramIBinder)
  {
    this.isBinding = false;
    this.bound = true;
  }
  
  public void onServiceDisconnected(ComponentName paramComponentName)
  {
    this.bound = false;
  }
  
  public boolean unbindService()
  {
    boolean bool = false;
    try
    {
      if (this.bound)
      {
        this.context.unbindService(this);
        this.bound = false;
        bool = true;
      }
      return bool;
    }
    finally
    {
//      localObject = finally;
//      throw ((Throwable)localObject);
    }
  }
}


/* Location:              G:\zyl\ylwork\Android\Android_Decode\apk2java\apktool2.1.0\WatchFaceSports\classes-dex2jar.jar!\com\tencent\tws\watchfacelib\ServiceConnectionManager.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */